package com.aidex.common.core.domain.entity;

import com.aidex.common.core.domain.BaseTreeEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@EqualsAndHashCode(callSuper = true)
@Api(tags = "菜单权限对象")
public class SysMenu extends BaseTreeEntity<SysMenu> {

    @ApiModelProperty("部门名称")
    @NotBlank(message = "菜单名称不能为空")
    @Size(max = 50, message = "菜单名称长度不能超过50个字符")
    private String menuName;

    @ApiModelProperty("部门名称")
    @NotBlank(message = "菜单编码不能为空")
    @Size(max = 50, message = "菜单编码长度不能超过50个字符")
    private String menuCode;

    @ApiModelProperty("父菜单名称")
    @TableField(exist = false)
    private String parentName;

    @ApiModelProperty("路由地址")
    @Size(max = 200, message = "路由地址不能超过200个字符")
    private String path;

    @ApiModelProperty("组件路径")
    @Size(max = 200, message = "组件路径不能超过255个字符")
    private String component;

    @ApiModelProperty("是否外链")
    private String isFrame;

    @ApiModelProperty("是否缓存")
    private String isCache;

    @ApiModelProperty("菜单类型")
    @NotBlank(message = "菜单类型不能为空")
    private String menuType;

    @ApiModelProperty("显示状态")
    private String visible;

    @ApiModelProperty("菜单状态")
    private String status;

    @ApiModelProperty("权限标识")
    @Size(max = 100, message = "权限标识长度不能超过100个字符")
    private String perms;

    @ApiModelProperty("菜单图标")
    private String icon;

    @TableField(exist = false)
    private String title;

    public String getTitle() {
        return menuName;
    }

    @TableField(exist = false)
    private String key;

    public String getKey() {
        return menuCode;
    }
}
